package com.carrot.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum CellReflectionTypeEnum {

    ONE_TO_ONE("1", "一个单体一个单体类型"),
    MANY_TO_ONE("2", "多个单体一个单体类型"),
    ONE_TO_MANY("3", "一个单体多个单体类型");

    private final String value;

    private final String name;

    /**
     * 根据类型获取名称
     */
    public static String getCellReflectionTypeName(String value){
        Map<String, String> enumMap = Stream.of(CellReflectionTypeEnum.values())
                .collect(Collectors.toMap(CellReflectionTypeEnum::getValue, CellReflectionTypeEnum::getName));
        return enumMap.getOrDefault(value,"");
    }
}
